﻿@using WineStore.Extends;
@model WineStore.Models.Product
@{
    ViewBag.Title = "EditProduct";
    Layout = "~/Views/Shared/AdminLayout.cshtml";
}
@section Styles
{
    <style type="text/css">
        input, textarea, select {
            padding: 5px;
            border: 1px solid #ccc;
            border-radius: 3px;
            width: 200px;
            color: #333;
            box-shadow: rgba(0,0,0,0.1)0px 0px 8px;
            -moz-box-shadow: rgba(0,0,0,0.1)0px 0px 8px;
            -webkit-box-shadow: rgba(0,0,0,0.1)0px 0px 8px;
        }

        textarea {
            width: 400px;
            height: 100px;
            max-width: 400px;
            line-height: 18px;
            border-radius: 3px;
        }
         

            input:hover, textarea:hover, select:hover
            input:focus, textarea:focus, select:focus {
                border-color: 10px solid #C9C9C9;
                box-shadow: rgba(0,0,0,0.2)0px 0px 8px;
                -moz-box-shadow: rgba(0,0,0,0.2)0px 0px 8px;
                -webkit-box-shadow: rgba(0,0,0,0.2)0px 0px 8px;
                border-radius: 3px;
            }

        input .submit{
            height: 38px;
            background-color: #474E69;
            color: #FFF;
            border-radius: 3px;
            -moz-border-radius: 3px;
            -webkit-border-radius: 3px;
        }
    </style>
}
<!-- Table (TABLE) -->
@if (Session["Admin"] != null)
{
    <h3 class="tit">Edit Product
    </h3>
    <fieldset>
        <legend>Edit Product</legend>
        @using (Html.BeginForm("EditProduct", "Product", FormMethod.Post, new { enctype = "multipart/form-data" }))
        { 
            @Html.ValidationSummary(true)
            @Html.HiddenFor(model => model.ProductId)
            <table class="nostyle">
                <tbody>
                    <tr>
                        <td>Category Name:<span style="color: Red">(*)</span>
                        </td>
                        <td>
                            @*name va id phai co gia tri giong ten truong trong database*@
                            @Html.DropDownListFor(model => model.CategoryId, null, "-- CategoryName --", new { style="width:212px;"})
                        </td>
                        <td style="color: Red;">
                            @Html.ValidationMessageFor(model => model.CategoryId)
                        </td>
                    </tr>
                    <tr>
                        <td>Product Name (English):<span style="color: Red">(*)</span>
                        </td>
                        <td>
                            @*name va id phai co gia tri giong ten truong trong database*@
                            @Html.EditorFor(model => model.ProductName_EN)
                        </td>
                        <td style="color: Red;">
                            @Html.ValidationMessageFor(model => model.ProductName_EN)
                        </td>
                    </tr>
                    <tr>
                        <td>Product Name (German):<span style="color: Red">(*)</span>
                        </td>
                        <td>
                            @*name va id phai co gia tri giong ten truong trong database*@
                            @Html.EditorFor(model => model.ProductName_GER)
                        </td>
                        <td style="color: Red;">
                            @Html.ValidationMessageFor(model => model.ProductName_GER)
                        </td>
                    </tr>
                    <tr>
                        <td>Product Price:
                        </td>
                        <td>
                            @Html.EditorFor(model => model.ProductPrice)
                        </td>
                        <td></td>
                    </tr>
                    <tr>
                        <td style="vertical-align:middle;">Product Image:<span style="color: Red">(*)</span>
                        </td>
                        <td>
                            @Html.ImageFor(model => "../../Content/Images/Products/" + model.ProductImage, new { width = "204px", height = "200px", alt = "some alt text" })
                            @Html.TextBoxFor(model => model.ProductImage, new { type = "file" })
                        </td>
                        <td style="color: Red;"></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td>
                            <input type="submit" value="Edit Product" style="width:100px;" class="submit"/>
                        </td>
                    </tr>
                </tbody>
            </table>
        }
    </fieldset>
}
else
{
    Response.Redirect("~/Admin/LogOn/");
}